#include <iostream>
using std::cout;
using std::endl;

//复数
class Complex
{
public:
    Complex(int real,int image)
    : _real(real)
    , _image(image)
    {}

    void print() const{
        cout << _real << " + " << _image << "i" << endl;
    }

    //成员函数的方式进行重载
    Complex operator+(const Complex & rhs){
        /* _real = 100; */
        return Complex(_real + rhs._real,_image + rhs._image);
    }
private:
    int _real;
    int _image;
};


void test0(){
    int a = 1,b = 2;
    /* &(a + b); */
    cout << a + b << endl;

    Complex cx(1,2);
    Complex cx2(3,4);
    /* add(cx,cx2).print(); */


    /* Complex cx3 = cx.operator+(cx2); //本质 */
    Complex cx3 = cx + cx2;
    cx3.print();
}

void test1(){
    int num = 10;
    cout << sizeof(int) << endl;
    cout << sizeof(num)<< endl;
    cout << sizeof num << endl;
}

int main(void){
    test0();
    return 0;
}
